home *** CD-ROM | disk | FTP | other *** search
-
-
-
-
-
-
- LptInit
-
- by J. Scott Sanbar
-
- 8100 Glenwood
- Oklahoma City, OK 73114
-
- CIS: 73760,3304
-
-
-
-
- LPTINIT.PAS is a demonstration program, and a useful command line utility
- for determining the disposition of a printer. It is written for Turbo
- Pascal 5.x, and also included is the compiled and ready to run executable
- LPTINIT.EXE. IBM PC/XT/AT/PS/2 and true compatibles only.
-
- BIOS interrupt $17 is often used to determine whether a printer is ready
- to receive output and diagnose its status. Indeed, I used to use it
- and still do. However, I found it to be inadequate in situations where
- a printer has been disconnected while on or has a bad cable. In these
- cases, Intr. $17 would report an online printer which was not really
- online and which would lock up upon access.
-
- The technique used in LptInit is to directly access the parallel port
- and send a reset signal to the printer. Based on the behaviour of the
- status register after the reset is sent I can more reliably diagnose
- the true status of the printer.
-
- The drawbacks are that the printer is reset, which usually denotes activity
- on the printer. For instance, on my Panasonic KX-P1180 the printhead is
- returned to the left edge of the platten. This is generally harmless
- and may actually be desirable but can take a little time. Also, if an
- offline situation is detected the program will timeout. I have set the
- timeout to a conservative level so there will be a noticeable pause,
- although this can easily be altered.
-
- Therefore, this technique is best used only sparingly, perhaps at the
- beginning of a program or once before each printout. Thereafter, repeated
- checks should use Intr. $17 or rely on the critical error handler to
- pass back an error condition.
-
- This text and the program LPTINIT.PAS are both:
-
- Copyright (C) 1990 by J. Scott Sanbar. All rights reserved.
-
- I hereby commit LPTINIT.PAS to the public domain, to be freely distributed,
- used and altered by anyone without fee.
-
- NOTE: One anomaly I could not resolve. If the printer is disconnected
- while the printer is on but the printer is either offline or out of paper
- this technique will fail to diagnose the cable disconnect, but will report
- printer offline or out of paper, reporting the pre-disconnect status.
- Although this is probably not a critical problem, it is nevertheless
- an anomaly. Every other situation I could think of is accurately
- diagnosed, at least on my equipment, and it never reports printer ready
- when it is not, which is the critical test.